package org.example.trainTicketSystem.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.example.trainTicketSystem.DTO.RegisterDTO;

import java.io.Serializable;

@Data
@NoArgsConstructor
@TableName("user")
public class User implements Serializable {

    @TableId(type = IdType.AUTO)
    private Integer userId;

    @TableField
    private String username;

    @TableField
    private String password;

    @TableField
    private String passengerName;

    @TableField("passenger_id")
    private String passengerId;

    @TableField
    private String phone;

    @TableField
    private Boolean Admin;

    public User(RegisterDTO registerDTO) {
        this.username = registerDTO.getUsername();
        this.password = registerDTO.getPassword();
        this.passengerName = registerDTO.getPassengerName();
        this.passengerId = registerDTO.getPassengerId();
        this.phone = registerDTO.getPhone();
        this.Admin = registerDTO.isAdmin();
    }

}
